package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.UploadFilesBean;
import com.xuxin.baby.contract.ChildGreatRecordContract;
import com.xuxin.baby.model.ChildGreatRecordModel;

import java.util.List;

import okhttp3.MultipartBody;

/**
 * Created by xu_xin
 * Created on 2020/10/22 0022
 * 记录大事记和病历
 */
public class ChildGreatRecordPresenter implements ChildGreatRecordContract.Presenter {
    private final ChildGreatRecordModel model;
    private final ChildGreatRecordContract.View view;

    public ChildGreatRecordPresenter(ChildGreatRecordContract.View view) {
        this.view = view;
        model = new ChildGreatRecordModel();
    }

    @Override
    public void record(String tenantId,
                       String token,
                       String childId,
                       String eventType,
                       String eventTitle,
                       String eventContent,
                       String medicalRecord,
                       String address,
                       String eventDate,
                       String pic1,
                       String pic2,
                       String pic3) {
        if (null != model) {
            model.record(this,
                    tenantId,
                    token,
                    childId,
                    eventType,
                    eventTitle,
                    eventContent,
                    medicalRecord,
                    address,
                    eventDate,
                    pic1,
                    pic2,
                    pic3);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}